const arr = {
    '42': 3,
    '3': 3,
    '30': 4,
    '43': 4,
    '31': 5,
    '45': 6,
    '47': 8,
    '8': 8,
    '34': 8,
    '21':8,
    '48': 9,
    '49': 10,
    '13': 13,
    '27': 14,
    '1': 14,
};


let obj = {};
for(let key in arr){
    const v = arr[key];
    if(!obj[v]){
        obj[v] = [];
    }
    
    const item = {};
    item[key] = v;
    obj[v].push(item);
    
}
console.log(obj);

let obj1 = {};
for(let key in obj){
    const item = obj[key];
    const len = item.length;
    if(!obj1[len]){
        obj1[len] = [];
    }
    obj1[len].push(item);
}
console.log(obj1);

debugger;